home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / ifl / iflBitArray.z / iflBitArray
Text File  |  1998-10-20  |  5KB  |  132 lines

  1.  
  2.  
  3.  
  4. iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy((((3333))))    IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll     iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy - limited subscriptable bit array class
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      none, standalone object
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <ifl/iflBitArray.h>
  16.  
  17. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      This class implements a very limited functionality subscriptable bit
  19.      array that is used by the image data type converter (iflConverter).  The
  20.      constructor requires a void* initializer, so a form such as
  21.  
  22.           int from[1024], to[1024];
  23.           iflBitArray f = from, t = to;
  24.  
  25.      declares bit "pointers" referencing the iiiinnnntttt arrays.  The bit array can
  26.      then be accessed with contructs of the form
  27.  
  28.           floatVal = (float)f[i];
  29.  
  30.      and deposits made with statements such as
  31.  
  32.           t[i] = floatVal;    // no cast needed
  33.  
  34.  
  35. CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
  36.      CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
  37.  
  38.           iflBitArray(void* dp)
  39.  
  40.  
  41.      SSSSuuuubbbbssssccccrrrriiiipppptttteeeedddd aaaacccccccceeeessssssss
  42.  
  43.           iflBitArray& operator[](int idx)
  44.           void operator=(long rhs)
  45.           operator long()
  46.  
  47.  
  48. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  49.      iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy(((())))
  50.  
  51.           iflBitArray(void* dp)
  52.  
  53.  
  54.           Constructs a bit "pointer" that accesses the bit array pointed to by
  55.           _d_p.  Use the subscript operator to access elements of the array off
  56.           this pseudo-pointer on either the left-hand or right-hand side of an
  57.           assignment.
  58.  
  59.  
  60.  
  61.                                                                         PPPPaaaaggggeeee 1111
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy((((3333))))    IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll     iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy((((3333))))
  69.  
  70.  
  71.  
  72.      ooooppppeeeerrrraaaattttoooorrrr[[[[]]]]
  73.  
  74.           iflBitArray& operator[](int idx)
  75.  
  76.  
  77.           The subscript operator stores the byte and bit offsets needed to
  78.           access the element specified by _i_d_x. This function returns a self-
  79.           reference so the real work can be done with the cast and assigment
  80.           operators for this class.  It works with certain restrictions noted
  81.           below.
  82.  
  83.      ooooppppeeeerrrraaaattttoooorrrr====
  84.  
  85.           void operator=(long rhs)
  86.  
  87.  
  88.           The assignment operator clears or sets the bit pointed to by the
  89.           left-hand side of the assigment.  The bit is set if _r_h_s is nonzero,
  90.           otherwise it is cleared.  By only allowing a long for the right-hand
  91.           side, a bit subscript on the right is automatically extracted by
  92.           going through the cast operator.  C++ converts other types such as
  93.           ffffllllooooaaaatttt and sssshhhhoooorrrrtttt to lllloooonnnngggg without complaining.
  94.  
  95.      ooooppppeeeerrrraaaattttoooorrrr lllloooonnnngggg
  96.  
  97.           operator long()
  98.  
  99.  
  100.           The cast operator extracts the (previously remembered) subscripted
  101.           bit.  Again, C++ fills in all the other type conversions.
  102.  
  103. NNNNOOOOTTTTEEEESSSS
  104.      Due to limitations of the implementation, the same bit "pointer" must not
  105.      occur twice in the same assignment (with different subscripts):
  106.  
  107.           t[i] = ~(long)t[j];  // bogus result (depends on order of evaluation)
  108.           t[i] = f[j];   // ok even if 't' and 'f' point to same data array
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                                                         PPPPaaaaggggeeee 2222
  128.  
  129.  
  130.  
  131.